package com.heima.comment.controller;

import com.heima.comment.dto.CommentRepayDto;
import com.heima.comment.dto.CommentRepayLikeDto;
import com.heima.comment.dto.CommentRepaySaveDto;
import com.heima.comment.service.ICommentRepayService;
import com.heima.common.dto.ResponseResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/comment_repay")
public class CommentRepayController {
    @Autowired
    private ICommentRepayService iCommentRepayService;

    @PostMapping("/save")
    @ApiOperation(value = "保存评论回复", notes = "author:mcm")
    public ResponseResult saveRepay(@RequestBody CommentRepaySaveDto dto){
        return iCommentRepayService.saveRepay(dto);
    }

    @PostMapping("/like")
    @ApiOperation(value = "保存评论点赞", notes = "author:mcm")
    public ResponseResult saveRepayLike(@RequestBody CommentRepayLikeDto dto){
        return iCommentRepayService.saveRepayLike(dto);
    }

    @PostMapping("/load")
    @ApiOperation(value = "加载评论点赞", notes = "author:mcm")
    public ResponseResult loadRepayLike(@RequestBody CommentRepayDto dto){
        return iCommentRepayService.loadRepayLike(dto);
    }
}
